import parole
from parole.colornames import colors
from parole.display import interpolateRGB
import pygame, random

import sim, main, dungeon
from util import *

class Scroll(sim.Scroll):
    def __init__(self):
        sim.Scroll.__init__(self, "illumination", "?", colors['White'])

    def read(self, reader):
        self.map = main.mapFrame.getMap()
        self.originalIntensity = self.map.ambientIntensity

        self.map.setAmbientLight((255,255,255), 0.4)
        self.map.update()

        main.schedule.add(sim.Event('expire effect', main.schedule.time + 2*60000,
            (self,), dests=[self]))

    def listen(self, event):
        sim.Scroll.listen(self, event)

        if event.id == 'expire effect' and event.args[0] is self:
            self.map.setAmbientLight((255,255,255), self.originalIntensity)
            self.map.update()


#========================================
thingClass = Scroll


